home *** CD-ROM | disk | FTP | other *** search
- Path: mother.usf.edu!suntan!cdiaz
- From: "Carlos Diaz (CS)" <cdiaz@eng.usf.edu>
- Newsgroups: comp.lang.c
- Subject: Keyboard input: C's equivalent to BASIC's Inkey$
- Date: Thu, 11 Jan 1996 21:39:33 -0500
- Organization: University of South Florida
- Message-ID: <Pine.SUN.3.91.960111212844.17033A@suntan>
- NNTP-Posting-Host: suntan.eng.usf.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
- X-Sender: cdiaz@suntan
-
- Hi! Can someone tell me what the C equivalent of BASIC's Inkey$ command
- is? In particular, I'm looking to translate the following BASIC code to
- C. It's the old, "wait for a key- if there is no key do something else
- then wait for a key, etc".
-
- DO
- DO WHILE k$ = "" 'As long as there is no key, keep waiting
- k$=Inkey$
- ' Additional statements to increment a counter, update and display a
- ' clock with running seconds, etc, can go here.
- LOOP
- PRINT k$; 'Print the key that was just gotten
- k$=""
- LOOP
-
- It's the beginning of a customizable user input routine, and with some
- modification can serve to program the keyboard to move a cursor around,
- highlight menu selection, etc. Thank you for your help!
-
- Sincerely,
- Carlos E. Diaz
-
-